package com.sekill.miaosha.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sekill.miaosha.entity.TbStock;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 库存表，代表库存，秒杀库存等信息 Mapper 接口
 * </p>
 *
 * @author gao
 * @since 2021-06-18
 */
@Repository
public interface TbStockMapper extends BaseMapper<TbStock> {

    int savetbstock(@Param("tbStock")TbStock tbStock);

    /**
     * 需求：提交订单
     * 参数：Long id , String userId
     */
    void submitOrder(Long id, String userId);

    int updatestock(@Param("id") Long id);

    /**
     * 根据id查询库存par
     */
    TbStock findbyskuid(@Param("skuid")Long skuid);

    List<TbStock> selectstockByName(Map<String, Object> map,RowBounds rowBounds);

}

